package com.by;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

@SpringBootApplication
@EnableDiscoveryClient //服务注册到nacos
@EnableCaching  // 开启注解式缓存(默认使用缓存中间件redis)
//开启缓存功能，添加该注解之后，Spring容器知道需要使用缓存功能，其它与缓存相关的注解才会生效
public class ManagerServiceApplication
{
    public static void main( String[] args )
    {
        SpringApplication.run(ManagerServiceApplication.class, args);
    }

    //    密码加密器
    @Bean
    public BCryptPasswordEncoder passwordEncoder() {
//        BCryptPasswordEncoder方法采用了SHA-256+随机盐+密钥对密码进行加密
        return new BCryptPasswordEncoder();
    }
}
